import roadData from '../assets/GIS_Data/Wuhan_roads.json'
import cityData from '../assets/GIS_Data/Wuhan_Buildings.json'

import {CityBuildingLayer, LineLayer} from '@antv/l7'

export default(scene)=>{
    // 道路图层优化
    const road_layer = new LineLayer({
        name:'武汉道路',
        zIndex: 1,
        blend: 'normal',
        pickingBuffer: 1
    })
    road_layer.source(roadData)
    .size(1)
    .shape('line')
    .color('#1990FF')
    .style({
        opacity: 0.8,
        lineType: 'solid'
    })
    // 只在需要时启用动画
    .animate({
        interval: 2,    // 增加间隔
        trailLength: 3, // 增加长度
        duration: 3,    // 增加持续时间
    });
    scene.addLayer(road_layer);

    // 建筑物图层优化
    const building_layer = new CityBuildingLayer({
        name:'武汉',
        zIndex: 2,
        blend: 'normal',
        pickingBuffer: 1
    })
    building_layer.source(cityData)
    .size('Elevation', (h)=>h)
    .animate(false) // 默认关闭动画
    .active({
        color: '#0ff',
        mix: 0.3  // 降低混合强度
    })
    .style({
        opacity: 0.6,
        baseColor: 'rgb(16, 16, 16)',
        windowColor: 'rgb(30, 60, 89)',
        brightColor: 'rgb(255, 176, 38)',
        sweep: {
            enable: false, // 默认关闭扫描效果
            sweepRadius: 2,
            sweepColor: '#1990FF',
            sweepSpeed: 0.5,
            sweepCenter: [ 114.4, 30.5 ]
        }
    });
    scene.addLayer(building_layer);

    // 返回图层实例，方便后续控制
    return {
        road_layer,
        building_layer
    };
}